<%@ page import="java.io.File" %><%--
  Created by IntelliJ IDEA.
  User: Administrator
  Date: 2020/8/27
  Time: 9:04
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>课程资源</title>
    <link rel="stylesheet" href="/SystemerNav/SystemerNav.css" type="text/css">
    <link rel="stylesheet" href="https://unpkg.com/purecss@1.0.0/build/pure-min.css" integrity="sha384-CCTZv2q9I9m3UOxRLaJneXrrqKwUNOzZ6NGEUMwHtShDJ+nCoiXJCAgi05KfkLGY" crossorigin="anonymous">
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@3.3.7/dist/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
</head>
<body background="/LoginInterface/loginFace.jpg">
<div class="container">
    <div class="top">
        <ul class="nav nav-pills">
            <li role="presentation" class="active"><a href="StudentLesson.jsp?courseNo=<%=request.getParameter("courseNo")%>&workerNo=<%=request.getParameter("courseNo")%>">首页</a></li>
            <li role="presentation"><a href="myWork.jsp?courseNo=<%=request.getParameter("courseNo")%>&workerNo=<%=request.getParameter("workerNo")%>">我的作业</a></li>
            <li role="presentation"><a href="CourseResourse.jsp?courseNo=<%=request.getParameter("courseNo")%>&workerNo=<%=request.getParameter("workerNo")%>">课程资源</a></li>
        </ul>
        <table class="table table-hover">
            <thead>
            <tr>
                <th>单元学习</th>
                <th>查看</th>
            </tr>
            </thead>
            <tbody>
            <%
                /*response.setCharacterEncoding("GBK");
                request.setCharacterEncoding("GBK");*/
                String courseNo=request.getParameter("courseNo");
                String workerNo=request.getParameter("workerNo");
                try {
                    File fDir=new File("F:\\JWGLXT\\web\\StoreResoures\\"+workerNo+"\\"+courseNo);
                    //若指定目录不存在则创建该目录
                    if(!fDir.exists()){
                        fDir.mkdirs();
                    }
                    String filePath="F:\\JWGLXT\\web\\StoreResoures\\"+workerNo+"\\"+courseNo;

                    //若指定目录存在
                    if(fDir.isDirectory() && fDir.exists()){
                        //取出目录下的文件
                        String [] f_array=fDir.list();
                        //遍历并打印出文件
                        for(int i=0;i<f_array.length;i++)
                        {
            %>
            <tr>
                <td><%=f_array[i]%></td>

                <td>
                    <form action="stuKnowLedgePoint.jsp" target="_blank">
                        <input type="hidden" name="courseNo" value="<%=courseNo%>">
                        <input type="hidden" name="workerNo" value="<%=workerNo%>">
                        <input type="hidden" name="dirName" value="<%=f_array[i]%>">
                        <input type="hidden" name="filePath" value="<%=filePath%>">
                        <button type="submit" class="btn btn-success">查看知识点</button>
                    </form>
                </td>
            </tr>

            <%
                        }
                    }
                }catch (Exception e){
                    e.printStackTrace();
                }
            %>
            </tbody>
        </table>
    </div>
</div>
</body>
</html>
